package net.blank.ui
{
	import flash.display.BitmapData;
	import flash.geom.Rectangle;
	
	import net.blank.functionUtl.FunctionBinder;
	import net.blank.ui.core.Skin;
	
	/**
	 * 滑块皮肤
	 * @author blank
	 * 
	 */
	public class SliderSkin extends Skin
	{
		/**
		 * 滑块按钮皮肤
		 */
		private var _sliderButtonSkin:ButtonSkin;
		
		/**
		 * 滑块皮肤
		 * @param background
		 * @param innerScaleRect
		 * @param sliderBtnSkin
		 * @param disabledFilters
		 * 
		 */
		public function SliderSkin(
			background:BitmapData=null, 
			innerScaleRect:Rectangle=null, 
			sliderButtonSkin:ButtonSkin=null,
			disabledFilters:Array=null
		){
			super(background, innerScaleRect, disabledFilters);
			
			_sliderButtonSkin=sliderButtonSkin;
		}
		
		/**
		 * 滑块按钮皮肤(可绑定)
		 * @param value
		 * 
		 */
		public function setSliderButtonSkin(value:ButtonSkin):void{
			if(value != _sliderButtonSkin){
				_sliderButtonSkin=value;
				
				FunctionBinder.execCallbackFun(setSliderButtonSkin,[value]);
			}
		}
		/**
		 * 滑块按钮皮肤
		 * @return 
		 * 
		 */
		public function getSliderButtonSkin():ButtonSkin{
			return _sliderButtonSkin;
		}
		
		override public function destroy():void{
			FunctionBinder.clearBindingFuns(setSliderButtonSkin);
			_sliderButtonSkin.destroy();
			_sliderButtonSkin=null;
			
			super.destroy();
		}
		
		override public function clone():*{
			return new SliderSkin(
				_background ? _background.clone() : null,
				_innerScaleRect ? _innerScaleRect.clone() : null,
				_sliderButtonSkin ? _sliderButtonSkin.clone() : null,
				_disabledFilters ? cloneFilters(_disabledFilters) : null
			);
		}
	}
}